package com.elitel.frame.base.controller.accessControl;

import com.elitel.frame.base.service.ApplicationServiceRelationService;
import com.elitel.frame.main.entity.AcAppServiceRelation;
import com.elitel.frame.main.entity.vo.AcAppServiceRelationVo;
import com.elitel.frame.main.entity.vo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 访问控制-应用和服务关系控制器
 * @author hi_bj
 */
@Controller
@RequestMapping("/accesscontrol/appservicerelation")
public class ApplicationServiceRelationController {

    @Autowired
    ApplicationServiceRelationService applicationServiceRelationService;

    /**
     * 获取数据列表
     *
     * @param acAppServiceRelation
     * @return JsonResult
     */
    @RequestMapping("/getDataList")
    @ResponseBody
    public Object getDataList(AcAppServiceRelation acAppServiceRelation) {
        JsonResult jr = new JsonResult();
        jr.setData(applicationServiceRelationService.getDataList(acAppServiceRelation));
        jr.setSuccess(true);
        return jr;
    }

    /**
     * 保存数据
     *
     * @param acAppServiceRelationVo
     * @return JsonResult
     */
    @RequestMapping("/save")
    @ResponseBody
    public Object save(@RequestBody AcAppServiceRelationVo acAppServiceRelationVo) {
        JsonResult jr = new JsonResult();
        jr.setData(applicationServiceRelationService.save(acAppServiceRelationVo));
        jr.setSuccess(true);
        return jr;
    }
}
